<?php include "../public/header.php";?>
<?php include "../public/header_public.php";?>
<link rel='stylesheet' href='/static/admin/css/engincha.css'>
<script type="text/javascript" src="/static/admin/echarts/echarts.min.js"></script>
<body style="padding-bottom: 50px">
<div class="tou" style="background-color: #FFFFFF">
    <div class="xxx">
        <img src="/static/admin/images/chaxiang.png" class="chaxiang">
        <span id="business_name"></span>
        <span id="engin_name"></span>
        <div class="qiinfo seacon" style="border-top: 0;padding-left: 68px"></div>
    </div>
    <div class="lan" style="background-color: #FFFFFF">
        <div id="nav_gai_zi" class="one layui-hide">工程概况</div>
        <div id="nav_gai_lian" class="one layui-hide">工程概况</div>
        <span id="authlanbut"></span>
    </div>
</div>
<div class="chanei" style="padding-top: 200px">
    <?php include "zi_fen.php";?>
    <?php include "zi_cheng.php";?>
    <?php include "zi_jin.php";?>
    <?php include "zi_piao.php";?>
    <?php include "zi_ren.php";?>
    <?php include "zi_xun.php";?>

    <?php include "lian_fen.php";?>
    <?php include "lian_cheng.php";?>
    <?php include "lian_jin.php";?>
    <?php include "lian_piao.php";?>
    <?php include "lian_fei.php";?>
    <?php include "lian_ren.php";?>
    <?php include "lian_xun.php";?>
</div>
<div style="height: 200px"></div>
<script>
    const colors = ['', '#5470C6', '#FAC858', '#91CC75', '#73C0DE', '#FD7E55', '#E87BCA', '#3BA272', '#EE6666'];
    var param_enginid = getQueryVariable('enginid') || 0;
    var param_pagezhan = getQueryVariable('pagezhan') || '';
    $("."+param_pagezhan).removeClass('layui-hide');

    layui.use(['laytp', 'form', 'laydate'], function() {
        var form = layui.form, layer = layui.layer, laydate = layui.laydate;
        facade.ajax({url: ask_engin_cha_dan,data:{enginid:param_enginid}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data;

                $("#business_name").html('【'+data.business_name+'】');
                $("#engin_name").html(data.name);


                var str = '';
                str += '<div class="hang">';
                if(data.business_name){str += '<span class="titzhan">'+data.business_name+'</span>';}
                if(data.state_name){str += '<span class="titzhan">'+data.state_name+'</span>';}
                if(data.engintype_name){str += '<span class="titzhan">'+data.engintype_name+'</span>';}
                if(data.jian_unit){str += '<span class="titzhan">'+data.jian_unit+'</span>';}
                if(data.areas){str += '<span class="titzhan">'+data.areas+'</span>';}
                str += '</div>';

                str += '<div class="hang hang_te">';
                str += '<span>中标金额：'+data.winfee+'元</span>';
                str += '<span>中标日期：'+data.windt+'</span>';
                if(data.business == 2 && data.lian_unit){
                    str += '<span>联营方/委托方： '+data.lian_unit+'</span>';
                }
                if(!data.man_xiang_name) data.man_xiang_name='';
                if(!data.shikaidt) data.shikaidt='';
                if(!data.shijundt) data.shijundt='';
                str += '<span>项目负责人： '+data.man_xiang_name+'</span>';
                str += '<span>实际开工日期：'+data.shikaidt+'</span>';
                str += '<span>实际竣工日期：'+data.shijundt+'</span>';
                str += '</div>';
                $(".qiinfo").html(str);
                




                if(data.business == 1){
                    $("#nav_gai_zi").removeClass('layui-hide');
                    dropdown_ziying();
                }else{
                    $("#nav_gai_lian").removeClass('layui-hide');
                    dropdown_lianying();
                }

                var func_name = 'func_'+param_pagezhan;
                if (typeof(window[func_name])!="undefined"){
                    window[func_name]();
                }


                var authlanbut = data.authlanbut;
                for (var key in authlanbut) {
                    var autstr = '';
                    autstr += '<div id="nav_'+authlanbut[key].id+'">'+authlanbut[key].name+'</div>';
                    $("#authlanbut").append(autstr);
                    dropdown_authlanbut("#nav_"+authlanbut[key].id, authlanbut[key].down)
                }



            }
        });
    });


    function dropdown_ziying(){
        layui.use('dropdown', function(){
            var dropdown = layui.dropdown
            dropdown.render({
                elem: '#nav_gai_zi'
                ,data: [
                    {title: '资金分析',id: 'zi_fen'},
                    {title: '成本分析',id: 'zi_cheng'},
                    {title: '进度分析',id: 'zi_jin'},
                    {title: '票税分析',id: 'zi_piao'},
                    {title: '人材机分析',id: 'zi_ren'},
                    {title: '巡检/整改',id: 'zi_xun'},
                ]
                ,click: function(data){
                    window.location.href = window.location.pathname+"?pagezhan="+data.id+"&enginid="+param_enginid;
                }
            });
        });
    }
    function dropdown_lianying(){
        layui.use('dropdown', function(){
            var dropdown = layui.dropdown
            dropdown.render({
                elem: '#nav_gai_lian'
                ,data: [
                    {title: '资金分析',id: 'lian_fen'},
                    {title: '成本分析',id: 'lian_cheng'},
                    {title: '进度分析',id: 'lian_jin'},
                    {title: '票税分析',id: 'lian_piao'},
                    {title: '费用分析',id: 'lian_fei'},
                    {title: '人材机分析',id: 'lian_ren'},
                    {title: '巡检/整改',id: 'lian_xun'},
                ]
                ,click: function(data){
                    window.location.href = window.location.pathname+"?pagezhan="+data.id+"&enginid="+param_enginid;
                }
            });
        });
    }
    function dropdown_authlanbut(elem, data){
        if(data.length < 1){
            $(elem).click(function () {
                facade.error("无菜单查看权限");return false;
            });
        }else{
            var authdata = [];
            for (var key in data){
                authdata.push(data[key]);
            }
            layui.use('dropdown', function(){
                var dropdown = layui.dropdown
                dropdown.render({
                    elem: elem
                    ,data: authdata
                    ,click: function(data){
                        openNavPage('查看'+data.title+'信息',data.id+'/index.php?enginid='+param_enginid);
                    }
                });
            });
        }
    }
</script>
</body>
</html>
